#ifndef DAVDIRRECURSIVE_H
#define DAVDIRRECURSIVE_H

#include "main.h"
#include "base_modul.h"
#include "qxml.h"
#include "main.h"
//

#include "networkdav.h"
#include "davdelete.h"
#include "davpropfind.h"

/*
emit InfoDavList(RegiDir,RegiFile,dirlevel);
*/

class DavDirRecursive : public QObject, public Base_Modul
{
    Q_OBJECT
//
public: 
    DavDirRecursive( NetworkDav * db , QString path )
{
    davuser = db->User();
    davpass = db->Pass();
    davhost = db->Host();
    davport = db->Port();
    initpath = path;
    StartGrabInfo(path);
protected:
  QString davuser;
  QString davpass;
  QString davhost;
  quint16 davport;
  QStringList Del_File;
  QStringList Del_Dir;
  QStringList Del_Work_Grep;
private:
    NetworkDav * db;
    int IdLevelX;
    QString initpath;
void StartGrabInfo( const QString path , int level )
{
     NetworkDav *acces = new NetworkDav(davhost,davuser,davpass,davport);
     DavPROPFIND *listin = new DavPROPFIND(acces,path);
                  listin->SetFormat(INFODIRLISTFORMAT,level);
     connect(listin, SIGNAL(WarningMsg(QString)), this, SLOT(ShowMessageWarning(QString)));
     connect(listin, SIGNAL(InfoDavList(QStringList,QStringList,int)), this, SLOT(RegisterRecursive(QStringList,QStringList,int)));
   
}
signals:

public slots:
void  RegisterRecursive(QStringList xdir ,QStringList xfile , int level )
{
     for (int i = 0; i < xdir.size(); ++i)  {
                  if ( xdir.at(i) !=initpath) {
                  Del_Work_Grep.append(xdir.at(i));  /* register to grab info */
                  }        
     }
     
     for (int i = 0; i < xfile.size(); ++i)  {
                  if ( xdir.at(i) !=initpath) {
                  Del_File.append(xfile.at(i));   /* register to delete */
                  }        
     }
     
     
     
     
}


};









#endif // DAVDIRRECURSIVE_H

